import 'package:flutter/material.dart';
import 'package:flutter_one/class/app/main/vm/MainViewModel.dart';
import 'package:flutter_one/class/appbase/BaseEmptyView.dart';
import 'package:flutter_one/class/appbase/BaseView.dart';
import 'package:flutter_one/class/appsetting/setting.dart';
import 'package:flutter_one/class/utils/Utils.dart';

/*主页面-view*/
class MainPageview extends StatefulWidget {
  const MainPageview({super.key});

  @override
  State<MainPageview> createState() => _MainPageviewState();
}

class _MainPageviewState extends State<MainPageview> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return BaseView<MainViewMdel>(
        viewModel: MainViewMdel(),
        build: (context, viewModel, child) {
          return Scaffold(
            backgroundColor:K_APP_BACKGROUND_COLOR,
            appBar: Utils.shareInstance.customPageBar('首页'),
            body: _setBody(),
          );
        },
        onModelReady: (viewModel) {
          //请求数据
          debugPrint("Main-onModelReady");
        });
  }
}

/*扩展*/
extension on _MainPageviewState {

  Widget _setBody() {
    debugPrint("_MainPageviewState-_setBody");
    return BaseEmptyView(
        orignalEmptyType: EmptyViewType.no_order,
        tapAction: () {
          debugPrint('我被点击了');
        });
  }

}
